import axios from "../until/axios";
import api from "./api";

// 新闻分类
export const getNewsType = () =>
  axios({
    method: "get",
    url: api.news.type,
  });
// 新闻列表
export const getNewsList = (params) =>
  axios({
    method: "get",
    url: api.news.newList,
    params,
  });
// 新闻详情
export const getNewDetail = (id) =>
  axios({
    method: "get",
    url: api.news.newDetail + id,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });
// 评论列表
export const getNewComment = (params) =>
  axios({
    method: "get",
    url: api.news.newComment,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
    params,
  });
// 评论详情commentDetail
export const getCommentDetail = (id) =>
  axios({
    method: "get",
    url: api.news.commentDetail + id,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });

// 评论点赞
export const likeComment = (id) =>
  axios({
    method: "PUT",
    url: api.news.likeComment + id,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });
// 发表评论
export const commentSend = (data) =>
  axios({
    method: "POST",
    url: api.news.commentSend,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
    data,
  });
// 新闻点赞
export const likeNew = (id) =>
  axios({
    method: "PUT",
    url: api.news.likeNew + id,
    headers: {
      Authorization: window.localStorage.getItem("token"),
    },
  });
